'use strict'

const log = require('./log.js')

var koa = require('koa')
var path = require('path')
var wechat = require('./wechat/g')
var util = require('./libs/util')

var wx = require('./wx/index')
var config = require('./wx/index')
var reply = require('./wx/reply')

var sha1 = require('sha1')

var wechat_file = path.join(__dirname, './config/wechat.txt')


var app = new koa();
// 路由
var Router = require('koa-router')
var router = new Router()
var game = require('./app/controllers/games')

// app.use(router['routes']());
router.get('/daojian', game.daojian)

router.get('/index', function (ctx, next) {
	ctx.body = 'Hello Koa2.0!';
});

app
  .use(router.routes())
  .use(router.allowedMethods());


// 自动回复
app.use(wechat(wx.wechatOptions.wechat, reply.reply))

app.listen(1234)
console.log('服务器跑起来了，127.0.0.1:1234')